﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Framework;

namespace PICUpdate
{
    public partial class Form1 : Form, IShowMessage
    {
        private BIZUpdate bIZUpdate = new BIZUpdate();

        public Form1()
        {
            InitializeComponent();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            string myServerAddress = txtServerAddress.Text;
            string myDataBase = txtDBName.Text;
            string myUsername = txtUserName.Text;
            string myPassword = txtPassword.Text;
            string localFilePath = txtFilePath.Text;
            string upUrl = txtUrl.Text;

            BIZUpdate bIZUpdate = new BIZUpdate();
            bIZUpdate.Start(txtServerAddress.Text, txtDBName.Text, txtUserName.Text, txtPassword.Text, txtFilePath.Text, txtUrl.Text, this);


        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            bIZUpdate.Stop();
        }

        public void ShowUpdateFile(string strFile)
        {
            this.BeginInvoke(new Action<string>(x => { this.labUpFile.Text = x; }),new object[]{strFile});
        }
    }
}
